package androidx.preference;

import android.content.Context;
import android.content.res.TypedArray;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.widget.EditText;
import androidx.preference.Preference;
import b.f.d.c.g;

public class EditTextPreference extends DialogPreference {
    private String W;
    private a X;

    public interface a {
        void a(EditText editText);
    }

    private static class b extends Preference.b {
        public static final Parcelable.Creator<b> CREATOR = new a();

        /* renamed from: b  reason: collision with root package name */
        String f777b;

        static class a implements Parcelable.Creator<b> {
            a() {
            }

            /* renamed from: a */
            public b createFromParcel(Parcel parcel) {
                return new b(parcel);
            }

            /* renamed from: b */
            public b[] newArray(int i) {
                return new b[i];
            }
        }

        b(Parcel parcel) {
            super(parcel);
            this.f777b = parcel.readString();
        }

        b(Parcelable parcelable) {
            super(parcelable);
        }

        public void writeToParcel(Parcel parcel, int i) {
            super.writeToParcel(parcel, i);
            parcel.writeString(this.f777b);
        }
    }

    public static final class c implements Preference.g<EditTextPreference> {

        /* renamed from: a  reason: collision with root package name */
        private static c f778a;

        private c() {
        }

        public static c b() {
            if (f778a == null) {
                f778a = new c();
            }
            return f778a;
        }

        /* renamed from: c */
        public CharSequence a(EditTextPreference editTextPreference) {
            return TextUtils.isEmpty(editTextPreference.M0()) ? editTextPreference.i().getString(r.not_set) : editTextPreference.M0();
        }
    }

    public EditTextPreference(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, g.a(context, m.editTextPreferenceStyle, 16842898));
    }

    public EditTextPreference(Context context, AttributeSet attributeSet, int i) {
        this(context, attributeSet, i, 0);
    }

    public EditTextPreference(Context context, AttributeSet attributeSet, int i, int i2) {
        super(context, attributeSet, i, i2);
        TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, t.EditTextPreference, i, i2);
        int i3 = t.EditTextPreference_useSimpleSummaryProvider;
        if (g.b(obtainStyledAttributes, i3, i3, false)) {
            w0(c.b());
        }
        obtainStyledAttributes.recycle();
    }

    public boolean A0() {
        return TextUtils.isEmpty(this.W) || super.A0();
    }

    /* access modifiers changed from: package-private */
    public a L0() {
        return this.X;
    }

    public String M0() {
        return this.W;
    }

    public void N0(String str) {
        boolean A0 = A0();
        this.W = str;
        f0(str);
        boolean A02 = A0();
        if (A02 != A0) {
            K(A02);
        }
        J();
    }

    /* access modifiers changed from: protected */
    public Object T(TypedArray typedArray, int i) {
        return typedArray.getString(i);
    }

    /* access modifiers changed from: protected */
    public void X(Parcelable parcelable) {
        if (parcelable == null || !parcelable.getClass().equals(b.class)) {
            super.X(parcelable);
            return;
        }
        b bVar = (b) parcelable;
        super.X(bVar.getSuperState());
        N0(bVar.f777b);
    }

    /* access modifiers changed from: protected */
    public Parcelable Y() {
        Parcelable Y = super.Y();
        if (G()) {
            return Y;
        }
        b bVar = new b(Y);
        bVar.f777b = M0();
        return bVar;
    }

    /* access modifiers changed from: protected */
    public void Z(Object obj) {
        N0(u((String) obj));
    }
}
